<?php
// +----------------------------------------------------------------------
// | KITEGO-Admin「开箱即用」「人人全栈」
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2024 https://www.kitego.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed KITEGO并不是自由软件，未经许可不能去掉KITEGO相关版权
// +----------------------------------------------------------------------
// | Author: KITEGO Team <bd@kitego.cn>
// +----------------------------------------------------------------------

namespace app\adminapi\controller\v1\maintenance;

use kitego\base\BaseController;
use kitego\services\devTools\EditorService;
use think\App;

class DevToolsController extends BaseController
{
    public array $safeAction = [];

    private EditorService $service;

    public function __construct(App $app, EditorService $service)
    {
        parent::__construct($app);
        $this->service = $service;
    }

    /**
     * 获取PHP代码
     */
    public function editParse()
    {
        if (empty($this->params['schema'])) exception('schema参数必需');

        return $this->service->index($this->params['schema']);
    }
}